package com.koushikdutta.ion.bitmap;

import java.lang.ref.SoftReference;
import java.util.Hashtable;

public class SoftReferenceHashtable<K, V> {
    Hashtable<K, SoftReference<V>> mTable = new Hashtable();

    public V put(K key, V value) {
        SoftReference<V> old = (SoftReference) this.mTable.put(key, new SoftReference(value));
        if (old == null) {
            return null;
        }
        return old.get();
    }

    public V remove(K k) {
        SoftReference<V> v = (SoftReference) this.mTable.remove(k);
        if (v == null) {
            return null;
        }
        return v.get();
    }
}
